package com.vishnu.jb;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.validator.DynaValidatorActionForm;

public class UserRegistrationFormFB extends DynaValidatorActionForm{

	public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){
		System.out.println("validate method ...............");
		ActionErrors aes=new ActionErrors();
		String password=(String)get("password");
		String retypePassword=(String)get("retypePassword");
		
		if(!password.equals(retypePassword)){
			aes.add("mismatch",new ActionMessage("Password.Mismatch"));
		}
		
		aes.add(super.validate(mapping, request));
		System.out.println("Errors after ="+request.getAttribute("org.apache.struts.action.ERROR"));
		System.out.println("validate method--------over..");
		return aes;
	}
	
}
